-
Notifications
You must be signed in to change notification settings - Fork 304
Expand file tree
/
Copy pathsimulate_touch.py
More file actions
34 lines (24 loc) · 1.06 KB
/
simulate_touch.py
File metadata and controls
34 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from zxtouch.client import zxtouch
from zxtouch.toasttypes import *
import time
from zxtouch.touchtypes import *
device = zxtouch("127.0.0.1")
device.show_toast(TOAST_WARNING, "Touching point (400, 400)", 1.5)
device.touch(TOUCH_DOWN, 1, 400, 400)
time.sleep(1.5)
device.show_toast(TOAST_WARNING, "Moving to point (400, 600)", 1.5)
device.touch(TOUCH_MOVE, 1, 400, 600)
time.sleep(1.5)
device.show_toast(TOAST_WARNING, "Touch up", 1.5)
device.touch(TOUCH_UP, 1, 400, 600)
time.sleep(1.5)
device.show_toast(TOAST_WARNING, "Touching point (100, 100)", 1.5)
device.touch(TOUCH_DOWN, 1, 100, 100)
time.sleep(0.1)
device.touch(TOUCH_UP, 1, 100, 100)
time.sleep(1.4)
device.show_toast(TOAST_WARNING, "Multitouching...Point (300, 300) and (500, 500)", 2.5)
device.touch_with_list([{"type": TOUCH_DOWN, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_DOWN, "finger_index": 2, "x": 500, "y": 500}])
time.sleep(1)
device.touch_with_list([{"type": TOUCH_UP, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_UP, "finger_index": 2, "x": 500, "y": 500}])
device.disconnect()